import { defineStore } from "pinia";
import useCounter from "./counter";
const userStore = defineStore("userStore", {
  state: () => {
    return {
      name: "hanlei",
      age: "18",
      info: {
        address: "我家住在黄土高坡",
      },
    };
  },
  getters: {
    // 如何使用其他的store
    Name(): string {
      const counterStore = useCounter();
      return this.name + counterStore.name;
    },
    age: (state) => state.age,
  },
  actions: {
    updateName(name: string) {
      this.name = name;
      return "我是更新名字" + name;
    },
  },
});

export default userStore;
